Inversions of spectropolarimetric observations of penumbral filaments deliver the stratification of different physical quantities in an optical depth scale. However, without establishing a geometrical height scale their three-dimensional geometrical structure can not be derived. This is crucial in understanding the correct spatial variation of physical properties in the penumbral atmosphere and to provide insights into the mechanism capable of explaining the observed penumbral brightness. The aim of this work is to determine a global geometrical height scale in the penumbra by minimizing the divergence of the magnetic field vector and the deviations from static equilibrium as imposed by a force balance equation that includes pressure gradients, gravity and the Lorentz force. Optical depth models are derived from the SIR inversion of spectropolarimetric data of an active region observed with SOT on-board the Hinode satellite. We use a genetic algorithm to determine the boundary condition for the inference of geometrical heights. The retrieved geometrical height scale permits the evaluation of the Wilson depression at each pixel and the correlation of physical quantities at each height. Our results fit into the uncombed penumbral scenario, i.e., a penumbra composed of flux tubes with channelled mass flow and with a weaker and more horizontal magnetic field as compared with the background field. The ascending material is hotter and denser than their surroundings. We do not find evidence of overturning convection or field free regions in the inner penumbral area analyzed. The penumbral brightness can be explained by the energy transfer of the ascending mass carried by the Evershed flow, if the physical quantities below z=-75km are extrapolated from the results of the inversion.